#region File Description
//-----------------------------------------------------------------------------
// FireParticleSystem.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion

#region Using Statements
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace mirror
{
    /// <summary>
    /// Custom particle system for creating a flame effect.
    /// </summary>
    class FireParticleSystem3D : ParticleSystem3D
    {
        public FireParticleSystem3D()
        { }


        protected override void InitializeSettings(ParticleSettings3D settings)
        {
            settings.TextureName = "particles3d/fire";

            settings.MaxParticles = 2400;


            float multiplier = 0.1f;
            float durationMultiplier = 0.5f;

            settings.Duration = TimeSpan.FromSeconds(2 * durationMultiplier);

            settings.DurationRandomness = 1;

            settings.MinHorizontalVelocity = 0 * multiplier;
            settings.MaxHorizontalVelocity = 15 * multiplier;

            settings.MinVerticalVelocity = -10 * multiplier;
            settings.MaxVerticalVelocity = 10 * multiplier;

            // Set gravity upside down, so the flames will 'fall' upward.
            settings.Gravity = new Vector3(0, 15, 0) * multiplier;

            settings.MinColor = new Color(255, 255, 255, 10);
            settings.MaxColor = new Color(255, 255, 255, 40);

            settings.MinStartSize = 5 * multiplier;
            settings.MaxStartSize = 10 * multiplier;

            settings.MinEndSize = 10 * multiplier;
            settings.MaxEndSize = 40 * multiplier;

            // Use additive blending.
            settings.BlendState = BlendState.Additive; 
        }
    }
}
